package com.ht.ui.report;

import javax.swing.*;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA.
 *
 * @author Dong Shufeng
 *         Date: 2011-2-23
 */
public class StatusReportMaker implements FesReportMaker {
    private int[] statusIds;
    private String[] statusNames;
    private String[] resourceIds;
    private String[] resourceNames;

    public StatusReportMaker(String[] resourceIds, String[] resourceNames, int[] statusIds, String[] statusNames) {
        this.resourceIds = resourceIds;
        this.resourceNames = resourceNames;
        this.statusIds = statusIds;
        this.statusNames = statusNames;
    }

    public JComponent createViewer(long start, long end) {
        StatusReportPanel statusReportPanel = new StatusReportPanel(start, end);
        statusReportPanel.setStatusQuery(this);
        statusReportPanel.setResourceId2displayNames(resourceIds, resourceNames);
        statusReportPanel.setStatusId2displayNames(statusIds, statusNames);
        return statusReportPanel;
    }

    public void closeViewer(JComponent c) {
        //todo: not finished...
    }

    public String exportExcel(JComponent component, String file) {
        StatusReportPanel p = (StatusReportPanel) component;
        return p.exportExcel(file);
    }

    public Map<Integer, long[][]> createDate(String resouceId, long startTime, long endTime) {
        return new HashMap<Integer, long[][]>();
    }

    public String[] getStatusNames() {
        return statusNames;
    }

    public String[] getResourceIds() {
        return resourceIds;
    }

    public String[] getResourceNames() {
        return resourceNames;
    }

    public int[] getStatusIds() {
        return statusIds;
    }
}
